home *** CD-ROM | disk | FTP | other *** search
- // trashcan.cpp
-
- // includes
- #include "trashcan.h"
- #include "Finder_res.h"
- #include "app_constants.h"
- #include "events.h"
-
- // constants
- // static strings
- const char k_Trash[]= "Trash";
-
- //
- // constructor
- //
- trashcan::trashcan(int x, int y, view* in_superview):
- icon(TrashCanBitmap, TrashCanMaskBitmap, k_Trash, x, y, in_superview)
- {
- m_full = false;
- }
-
- //
- // destructor
- //
- trashcan::~trashcan() {
- }
-
- //
- // fill_up()
- //
- void
- trashcan::fill_up() {
- m_full = true;
- set_icon(FullTrashCanBitmap, FullTrashCanMaskBitmap, false);
- }
-
- //
- // empty()
- //
- void
- trashcan::empty() {
- m_full = false;
- set_icon(TrashCanBitmap, TrashCanMaskBitmap, false);
- };
-
-
- //
- // do_cmd_self
- //
- Boolean
- trashcan::do_cmd_self (int in_eventID, void* io_data) {
- Boolean handled = false;
-
- switch (in_eventID) {
- case cmd_empty_trash:
- if (m_full) {
- empty();
- } else {
- fill_up();
- }
- send_update_event();
- handled = true;
- break;
- default:
- icon::do_cmd_self (in_eventID, io_data);
- break;
- }
- return handled;
- }
-